import { Exception } from "../../Framework/Util/Exception";
import { RMIEvent } from "./RMIEvent";
import { EventDispatcher } from "../../flash/events";
//class RMIDispatcher

export class RMIDispatcher extends EventDispatcher {
  constructor(block: ConstructorBlock) {
    
    super();if (RMIDispatcher._instance != null) {
      throw new Error("Only one RMIDispatcher instance should be instantiated");
    }
  }

  public dispatchErrorEvent(arg1: Exception): void {
    var evt = new RMIEvent(RMIEvent.RMI_ERROR, false, false, arg1);
    this.dispatchEvent(evt);
  }

  public static getInstance(): RMIDispatcher {
    if (RMIDispatcher._instance == null) {
      RMIDispatcher._instance = new RMIDispatcher(new ConstructorBlock());
    }
    return RMIDispatcher._instance;
  }

  private static _instance: RMIDispatcher;
}

class ConstructorBlock {}
